{config_load file='site.conf' section='share_index'}
{include file='header.tpl'}
{literal}
 <SCRIPT LANGUAGE="JavaScript">
 <!--
 	 $(document).ready(function()
	{
		$("#tb_list tr").mouseover(function(){$(this).addClass("over");}).mouseout(function(){$(this).removeClass("over");});
		$("#tb_list tr:even").addClass("alt");
		
		$("#myForm").validate({
			rules: {
				site_name: "required",
				site_url: {
					required: true,
					url: true
				}
			},
			messages: {
				site_name: "共有サイトのタイトルは必須です",
				site_url: {
					required: "共有サイトのURLは必須です",
					url: "正しくURLを入力してください。"
				}
			}
		});
	}
	);
					   
	function doDelSite(site_id)
	{
		if(confirm("本当にサイト["+site_id+"]を削除しますか"))
		{
			$("#actionType").attr("value","del");
			$("#site_id").attr("value",site_id);
			$("#delForm").submit();
		}
	}
	
	function doEditSite(site_id)
	{
		$("#actionType").attr("value","view");
		$("#site_id").attr("value",site_id);
		$("#delForm").attr("method","post");
		$("#delForm").attr("action","share_edit.php");
		$("#delForm").submit();
	}
 //-->
 </SCRIPT>
{/literal}
<div id="bg">
	<div id="page">
		<div id="content">
        	{if $msg ne ""}<div class="errorMsg">{$msg}</div>{/if}
			<div class="post">
				<h2 class="title">共有サイト登録</h2>
            </div>	
			<div class="post">
				<div class="entry">
								
				<form id="myForm" action="{$SCRIPT_NAME}" method="post">
                <input type="hidden" name="actionType" id="actionType" value="insert"/>
				<table width="600" id="tb_form">
				  <tr>
				    <th width="150" >サイト名<span class="required">(必須)</span></th>
				    <td width="450" ><input name="site_name" type="text" id="site_name" size="50" maxlength="200" ></td>
				  </tr>
				  <tr>
				    <th>サイトURL<span class="required">(必須)</span></th>
				    <td><input name="site_url" type="text" id="site_url" size="50" maxlength="200" ></td>
				  </tr>
				  <tr>
				    <th>公開フラグ</th>
				    <td>{html_options name=open_flag options=$openFlagList }</td>
				  </tr>
				  <tr>
				    <th>サイトURL正規表現</th>
				    <td><input name="reg_url" id="reg_url" type="text" size="50" maxlength="250" "/></td>
				  </tr>
				   <tr>
				    <th>FlashObject正規表現</th>
				    <td>
					<textarea name="reg_flashobj" id="reg_flashobj" cols="60" rows="6" ></textarea><br />
					{literal}
      ※{{cid}}=コンテンツID、{{cid2}}=コンテンツID2、{{width}}=プレイヤー幅、{{height}}=プレイヤー高さ。
	  {/literal}
					</td>
				  </tr>
				  <tr>
				    <th>動画種別</th>
				    <td>
					{html_options name=v_type options=$vTypeList}
					</td>
				  </tr>
				  <tr>
				    <th width="150" >&nbsp;</th>
				    <td width="450" >       
					<input type="submit" value="登録" class="submitButton">
				    <input type="reset"  value="リセット" class="submitButton">
					</td>
				  </tr>
				</table>
				</form>
				</div>
			</div>	
			<div class="post">	
			<h2 class="title">共有サイト一覧</h2>

            <form id="delForm" ction="{$SCRIPT_NAME}" method="post">
                <input type="hidden" name="actionType" id="actionType" value="del"/>
				<input type="hidden" name="site_id" id="site_id"/>
            </form>
				<div class="entry">
				{$paging}
                <table width="850" border="0" cellpadding="8" cellspacing="1" id="tb_list" >
                  <tr bgcolor="#CC0000">
                    <th>サイトID</th>
                    <th>サイト名(※サイトへのリンク付き)</th>
                    <th>公開(○or×)</th>
                    <th>URL正規表現(○or×)</th>
                    <th>FlashObj正規表現(○or×)</th>
                    <th>&nbsp;</th>
                  </tr>
				  
				  {foreach from=$sharelist item=row}
    				<tr bgcolor="#FFFFFF">
	                	<td>{ $row.site_id }</td>
    					<td>{ $row.site_name } <a href="{ $row.site_url }" target="_blank">GO</a></td>
    					<td>{if $row.open_flag != 0}○{else}×{/if}</td>
    					<td>{if $row.reg_url != ""}○{else}×{/if}</td>
						<td>{if $row.reg_flashobj != ""}○{else}×{/if}</td>
    					<td><a href="#" OnClick="doEditSite({$row.site_id});">編集</a> <a href="#" OnClick="doDelSite({$row.site_id});">削除</a></td>
                 	 </tr>
				  {/foreach}
                </table>
				{$paging}
			  </div>
			</div>
		</div>
		<!-- end #content -->
		<!-- end #sidebar -->
<div style="clear: both; height: 20px;">&nbsp;</div>
	</div>
	<!-- end #page -->
</div>
{include file='footer.tpl'}



